package com.accenture.fd.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.accenture.fd.dao.AuthorityDao;
import com.accenture.fd.dao.DesignTblDao;
import com.accenture.fd.dao.ItemControlDao;
import com.accenture.fd.dao.LogicalDataItemDao;
import com.accenture.fd.dao.MappingTblDao;
import com.accenture.fd.dao.ProcessListDao;
import com.accenture.fd.dao.ScreenItemDescriptionTblDao;
import com.accenture.fd.dao.Tb00008Dao;
import com.accenture.fd.entity.DesignEntity;
import com.accenture.fd.entity.ItemControlEntity;
import com.accenture.fd.entity.MappingEntity;
import com.accenture.fd.entity.ScreenItemDescriptionEntity;
import com.accenture.fd.entity.Tb00008;
import com.accenture.fd.service.IntegrityCheckService;

@Service
public class IntegrityCheckServiceImpl implements IntegrityCheckService {

	@Autowired
	private DesignTblDao designTblDao;

	@Autowired
	private MappingTblDao mappingTblDao;
	
	@Autowired
	private LogicalDataItemDao logicalDataItemDao;

	@Autowired
	private ScreenItemDescriptionTblDao screenItemDescriptionTblDao;
	
	@Autowired
	private AuthorityDao authorityDao;
	
	@Autowired
	private ItemControlDao itemControlDao;
	
	@Autowired
	private ProcessListDao processListDao;
	
	@Autowired
	private Tb00008Dao tb00008Dao;
	
	@Override
	public List<DesignEntity> getDesignList(String screenId, String designId) {
		return designTblDao.getDesignList(screenId, designId);
	}

	@Override
	public List<ScreenItemDescriptionEntity> getScreenItemDescriptionList(String screenId, String designId) {
		return screenItemDescriptionTblDao.getScreenItemDescriptionEntityList(screenId, designId);
	}

	@Override
	public List<MappingEntity> getMappingEntityList() {
		return mappingTblDao.getMappingList();
	}

	@Override
	public List<String> getLogicalDataItemName() {
		return logicalDataItemDao.getLogicalDataItemName();
	}
	@Override
	public List<String> getprocessid() {
		return processListDao.getprocessid();
	}

	@Override
	public void updateStatus(String screenId, String designId) {
		designTblDao.updateStatus(screenId, designId);
	}
	
	@Override
	public List<String> getUnauthorityItem(String screenId){
		return authorityDao.selForUnauthorityItem(screenId);
	}
	
	@Override
	public List<ItemControlEntity> getItemControl(String designTypeId, String screenId, int section){
		return itemControlDao.selItemControl(designTypeId,screenId,section);
	}
	
	@Override
	public List<String> getScreenIdList() {

		List<String> returnValue = new ArrayList<>();
		List<Tb00008> tb00008List = tb00008Dao.getScreenIdList();
		if (tb00008List != null && !tb00008List.isEmpty()) {

			for (int i = 0; i < tb00008List.size(); i++) {
				returnValue.add(tb00008List.get(i).getScreenId());
			}
		}

		return returnValue;
	}
}
